<?php

namespace IDock\Printer;

use IDock\Printer\Premium\PremiumCoveragePrinter;
use IDock\Printer\Premium\PremiumRelationPrinter;
use IDock\Printer\Premium\PremiumTaxPrinter;

class RenewalInquiryPrinter extends BasePrinter
{
    public $renewalFlg = false;

    /**
     * 车架号
     * @var string $vin
     */
    public $vin = '';

    /**
     * 车牌号
     * @var string $licenseNo
     */
    public $licenseNo = '';

    /**
     * 发动机号
     * @var string $engineNo
     */
    public $engineNo = '';

    /**
     * 初等时间
     * @var string $firstRegisterDate
     */
    public $firstRegisterDate = '';

    /**
     * 商业险起保日期
     * @var string $biStartData
     */
    public $biStartData = '';

    /**
     * 交强险起保日期
     * @var string $ciStartData
     */
    public $ciStartData = '';

    /**
     * 商业险终保日期
     * @var string $biEndData
     */
    public $biEndData = '';

    /**
     * 交强险终保日期
     * @var string $ciEndData
     */
    public $ciEndData = '';

    /**
     * 上年商业险保单号
     * @var string $biPolicyNo
     */
    public $biPolicyNo = '';

    /**
     * 上年交强险保单号
     * @var string $ciPolicyNo
     */
    public $ciPolicyNo = '';

    /**
     * 车辆信息
     * @var VehiclePrinter $vehiclePrinter
     */
    public $vehiclePrinter;

    /**
     * 投保人
     * @var  PremiumRelationPrinter $applicantPrinter
     */
    public $applicantPrinter;

    /**
     * 被保人
     * @var PremiumRelationPrinter $insuredPrinter
     */
    public $insuredPrinter;

    /**
     * 车主
     * @var PremiumRelationPrinter $ownerPrinter
     */
    public $ownerPrinter;

    /**
     * 拓展参数
     * @var $argc
     */
    public $argc;

    /**
     * 险种列表
     * @var array $coveragePrinterList
     */
    public $coveragePrinterList = [];

    /**
     * 是否续保
     * @param bool $renewal
     * @return void
     */
    public function setRenewalFlg(bool $renewal = false)
    {
        $this->renewalFlg = $renewal;
    }

    /**
     * 车辆信息
     * @param VehiclePrinter $vehiclePrinter
     */
    public function setVehiclePrinter(VehiclePrinter $vehiclePrinter): void
    {
        $this->vehiclePrinter = $vehiclePrinter;
    }

    /**
     * 投保人
     * @param PremiumRelationPrinter $applicantPrinter
     */
    public function setApplicantPrinter(PremiumRelationPrinter $applicantPrinter): void
    {
        $this->applicantPrinter = $applicantPrinter;
    }

    /**
     * 被保人
     * @param PremiumRelationPrinter $insuredPrinter
     */
    public function setInsuredPrinter(PremiumRelationPrinter $insuredPrinter): void
    {
        $this->insuredPrinter = $insuredPrinter;
    }

    /**
     * 车主
     * @param PremiumRelationPrinter $ownerPrinter
     */
    public function setOwnerPrinter(PremiumRelationPrinter $ownerPrinter): void
    {
        $this->ownerPrinter = $ownerPrinter;
    }

    /**
     * 险种
     * @param PremiumCoveragePrinter $coveragePrinter
     */
    public function setCoveragePrinterList(PremiumCoveragePrinter $coveragePrinter): void
    {
        $this->coveragePrinterList[] = $coveragePrinter;
    }

    //重写
    public function toArray(): array
    {
        $objectVars = get_object_vars($this);

        foreach ($objectVars as &$objectVar) {
            if (is_object($objectVar) and ($objectVar instanceof BasePrinter)) {
                $objectVar = $objectVar->toArray();
            }

            if (is_array($objectVar)) {
                foreach ($objectVar as &$value) {
                    if ($value  instanceof BasePrinter) {
                        $value = $value->toarray();
                    }
                }
            }
        }

        return $objectVars;
    }
}
